package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
@JsonIgnoreProperties("handler")
public class Travel extends BaseDomain {
    //拒绝
    public static final int STATE_REJECT=-1;
    //草稿
    public static final int STATE_NOMAL=0;
    //待发布
    public static final int STATE_WAIT=1;
    //已发布
    public static final int STATE_RELEASE=2;
    //热门 和发布
    public static final int STATE_HOT=3;
    //取消热门后的已发布
    public static final int STATE_RELEASE2=4;



    private String title;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd" ,timezone = "GMT+8")
    private Date travelTime;

    private String perExpends;

    private Integer days;

    private Integer person;

    private User author;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date createTime;

    private Date releaseTime;

    private Boolean isPublic;

    private Region place;

    private String coverUrl;
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date lastUpdateTime;

    private Integer state;

    private Travelcontent travelcontent;

    private Strategy strategy;

    private Integer count;

    private Integer likeCount;

    public String getJson(){
        Map<String,Object> map=new HashMap<>();
        map.put("id", id);
        map.put("title", title);
        map.put("coverUrl",coverUrl);

        return JSONUtil.toJSONString(map);
    }
}